<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>考勤时段表管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			//$("#name").focus();
			$("#inputForm").validate({
				
				submitHandler: function(form){
					checkTime();
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
		
		function checkTime()
		{
			 var starttime=$('#starttime').val();
			 $('#starttime').val("1970-01-01 "+starttime);
			 
	         var endtime=$('#endtime').val();
			 $('#endtime').val("1970-01-01 "+endtime);
			 
			 var checkintime1=$('#checkintime1').val();
			 $('#checkintime1').val("1970-01-01 "+checkintime1);
			 
			 var checkintime2=$('#checkintime2').val();
			 $('#checkintime2').val("1970-01-01 "+checkintime2);
			 
			 var checkouttime1=$('#checkouttime1').val();
			 $('#checkouttime1').val("1970-01-01 "+checkouttime1);
			 
			 var checkouttime2=$('#checkouttime2').val();
			 $('#checkouttime2').val("1970-01-01 "+checkouttime2);
			 
			 var startresttime=$('#startresttime').val();
			 $('#startresttime').val("1970-01-01 "+startresttime);
			 
			 var endresttime=$('#endresttime').val();
			 $('#endresttime').val("1970-01-01 "+endresttime);
		}
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/schedul/schclass/">考勤时段列表</a></li>
		<li class="active"><a href="${ctx}/schedul/schclass/form?id=${schclass.id}">考勤时段表<shiro:hasPermission name="schedul:schclass:edit">${not empty schclass.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="schedul:schclass:edit">查看</shiro:lacksPermission></a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="schclass" action="${ctx}/schedul/schclass/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>		
		<div class="control-group">
			<label class="control-label">时段名称：</label>
			<div class="controls">
				<form:input path="schname" htmlEscape="false" maxlength="100" class="input-xlarge required"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">国家：</label>
			<div class="controls">
				<sys:treeselect id="company" name="company" value="${schclass.company.id}" labelName="${schclass.company.name}" labelValue="${schclass.company.name}"
					title="部门" url="/sys/office/treeData?type=1" cssClass="required" allowClear="true" notAllowSelectParent="true"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">仓库：</label>
			<div class="controls">
				<sys:treeselect id="office" name="office" value="${schclass.office.id}" labelName="${schclass.office.name}" labelValue="${schclass.office.name}"
					title="部门" url="/sys/office/treeData?type=2" cssClass="required" allowClear="true" notAllowSelectParent="true"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">上班时间：</label>
			<div class="controls">
				<input id="starttime" name="starttime" type="text"  maxlength="20" class="input-medium Wdate required"
					value="<fmt:formatDate value="${schclass.starttime}" pattern="HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'HH:mm:ss',isShowClear:true});"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">下班时间：</label>
			<div class="controls">
				<input id="endtime" name="endtime" type="text"  maxlength="20" class="input-medium Wdate required"
					value="<fmt:formatDate value="${schclass.endtime}" pattern="HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'HH:mm:ss',isShowClear:true});"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">开始签到时间点：</label>
			<div class="controls">
				<input id="checkintime1" name="checkintime1" type="text"  maxlength="20" class="input-medium Wdate required"
					value="<fmt:formatDate value="${schclass.checkintime1}" pattern="HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'HH:mm:ss',isShowClear:true});"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">结束签到时间点：</label>
			<div class="controls">
				<input id="checkintime2" name="checkintime2" type="text"  maxlength="20" class="input-medium Wdate required"
					value="<fmt:formatDate value="${schclass.checkintime2}" pattern="HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'HH:mm:ss',isShowClear:true});"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">开始签退时间点：</label>
			<div class="controls">
				<input id="checkouttime1" name="checkouttime1" type="text"  maxlength="20" class="input-medium Wdate required"
					value="<fmt:formatDate value="${schclass.checkouttime1}" pattern="HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'HH:mm:ss',isShowClear:true});"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">结束签退时间点：</label>
			<div class="controls">
				<input id="checkouttime2" name="checkouttime2" type="text"  maxlength="20" class="input-medium Wdate required"
					value="<fmt:formatDate value="${schclass.checkouttime2}" pattern="HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'HH:mm:ss',isShowClear:true});"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">段中开始休息时间：</label>
			<div class="controls">
				<input id="startresttime" name="startresttime" type="text"  maxlength="20" class="input-medium Wdate"
					value="<fmt:formatDate value="${schclass.startresttime}" pattern="HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'HH:mm:ss',isShowClear:true});"/>
				<span class="help-inline"></span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">段中结束休息时间：</label>
			<div class="controls">
				<input id="endresttime" name="endresttime" type="text"  maxlength="20" class="input-medium Wdate"
					value="<fmt:formatDate value="${schclass.endresttime}" pattern="HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'HH:mm:ss',isShowClear:true});"/>
				<span class="help-inline"></span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">工作时间(分钟)：</label>
			<div class="controls">
				<form:input path="shiftworktime" htmlEscape="false" maxlength="40" class="input-xlarge digits required"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">延时是否计算加班：</label>
			<div class="controls">
				<form:select path="isovertime">
					<form:options items="${fns:getDictList('yes_no')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
				
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">备注信息：</label>
			<div class="controls">
				<form:textarea path="remarks" htmlEscape="false" rows="4" maxlength="255" class="input-xxlarge "/>
			</div>
		</div>		
		<div class="form-actions">
			<shiro:hasPermission name="schedul:schclass:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>